package com.framework.file.controller;

import com.framework.common.domain.ResultData;
import com.framework.file.model.SysFileFolder;
import com.framework.file.service.ISysFileFolderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Log4j2
@Api(tags = {"文件接口"})
@RestController
@CrossOrigin(origins = "*", maxAge = 3600)  //跨域请求
@RequestMapping(value = {"file-folder"})
public class SysFileFolderController {
    @Autowired
    private ISysFileFolderService sysFileFolderService;

    @ApiOperation("只编辑文件对象")
    @PostMapping(value = "/edit")
    public ResultData edit(@RequestBody SysFileFolder sysFile) {
        String id = sysFileFolderService.save(sysFile);
        return ResultData.data(id);
    }

    @ApiOperation("获取列表接口")
    @GetMapping("list")
    public ResultData list(@RequestParam String module) {
        List<SysFileFolder> list = sysFileFolderService.list(module);
        return ResultData.data(list);
    }
}
